<?php

namespace common\models\company;

use Yii;

/**
 * This is the model class for table "{{%company}}".
 *
 * @property int $id
 * @property int $parent_id 父级单位ID
 * @property string $name 单位名称
 * @property string $abbr 简称
 * @property string $logo 单位logo
 * @property string $description 备注
 * @property string $bank 开户银行名称
 * @property string $telephone 电话
 * @property string $email 邮箱
 * @property string $address 地址
 * @property string $contact 联系人
 * @property string $contact_phone 联系人电话
 * @property int $status 状态
 * @property int $created_at 入库时间
 * @property int $updated_at 更新时间
 * @property int $deleted_at 删除时间
 */
class Company extends \common\db\ActiveRecord {

    use \common\traits\Constants;

    const STATUS_DEFAULT = 0;
    const STATUS_ACTIVE = 10;

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return '{{%company}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['parent_id', 'status', 'created_at', 'updated_at', 'deleted_at'], 'integer'],
            [['name'], 'required'],
            [['name'], 'string', 'max' => 100],
            [['logo', 'description', 'abbr', 'address'], 'string', 'max' => 255],
            [['telephone', 'email', 'contact', 'contact_phone'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'parent_id' => '父级单位ID',
            'name' => '单位名称',
            'abbr' => '单位简称',
            'logo' => '单位logo',
            'description' => '备注',
            'telephone' => '电话',
            'email' => '邮箱',
            'address' => '地址',
            'contact' => '联系人',
            'contact_phone' => '联系人电话',
            'status' => '状态',
            'created_at' => '入库时间',
            'updated_at' => '更新时间',
            'deleted_at' => '删除时间',
        ];
    }

}
